home *** CD-ROM | disk | FTP | other *** search
- /* Horizontal Flip 1.0
- by Oscar, 12 Dec 2003
-
- this example simply flips a bitmap or object
-
- To run this: DROP the Script from Assets to the Object in Menu.
-
- Note: because of the bitmap merging, the text will become not-editable after you apply this
- */
-
- // Get the current menu and selected object when you drag and drop script
- // Note: if testing from Script editor make sure you have just one menu opened on desktop,
- // in such case the MenuGetCurSel will return currently opened menu
- menu = MenuGetCurSel()
- // VTS menu 1..255, VMG menu 10001..10255
-
- // show the current menu on top of all others
- MenuActivate(menu)
-
- object= ObjectGetCurSel(menu)
-
- if (object==0) then
- print "No object Selected"
- end
- endif
-
-
-
- //get the image buffer from object and store it in buffer 1
- ImgGrabObject(1,menu,object) // imgNum = temporary image buffer 1,2 or 3
-
- imgW = ImgGetWidth(1)
- imgH = ImgGetHeight(1)
-
- // create the target, same size
- ImgCreate(2,imgW,imgH)
-
- // trace is same as print, but it will appear only in the Output window in editor
- trace "W =",imgW, " H=",imgH
-
- // this is interpreter so it is slow!
- // show some progress or else people will see nothing happening for while
- ProgressBar(0,imgW,"Flipping!")
-
-
- for x=1 to imgW
- ProgressSetPos(x)
- ImgCopyCol(1,x,2,imgW-x+1)
- next x
-
- // now put the img buffer 2 into the object!
- ImgSetToObject(2,menu,object)